package day10;

import java.util.Calendar;
import java.util.Date;

public class Demo07 {
    public static void main(String[] args) {
        //Calendar  类  因为该类为抽象类，不能直接创建对象，不能直接new
        Calendar cl = Calendar.getInstance();
        int a = cl.get(Calendar.DATE);//获取当前时间天数
        System.out.println(a);
        int i = cl.get(Calendar.DAY_OF_YEAR);
        System.out.println(i);
        //add   月数为0-11
//        cl.add(Calendar.MONTH,2);
//        int m = cl.get(Calendar.MONTH);
//        System.out.println(m);
        //星期天为1   周六为7
        System.out.println(cl.get(Calendar.DAY_OF_WEEK));
        Date time = cl.getTime();//获取日历时间  Date对象
        System.out.println(time);//Tue Jan 12 13:01:22 CST 2021

    }
}
